/***************************************************************************
* Lyrics-Player                                                            *
* Copyright (C) 2012 Andrey Derevyanko <derandr@gmail.com>                 *
*                                                                          *
* This program is free software: you can redistribute it and/or modify     *
* it under the terms of the GNU General Public License as published by     *
* the Free Software Foundation, either version 3 of the License, or        *
* (at your option) any later version.                                      *
*                                                                          *
* This program is distributed in the hope that it will be useful,          *
* but WITHOUT ANY WARRANTY; without even the implied warranty of           *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
* GNU General Public License for more details.                             *
*                                                                          *
* You should have received a copy of the GNU General Public License        *
* along with this program.  If not, see <http://www.gnu.org/licenses/>.    *
***************************************************************************/

/*! \file coverInfoWnd.h
 *  \brief Window class for track information displaying declaration
 *  \author Andrey Derevyanko <derandr@gmail.com>
 *  \version 1.1
 *  \date 23/06/2012
 *  \copyright GNU Public License
 */

#ifndef COVERINFOWND_H
#define COVERINFOWND_H

#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#include <QPixmap>
#include <QString>
#include <QFile>
#include <QCheckBox>
#include <QPushButton>

#include "sharedStructures.h"

/*! \class coverInfoWnd
 *  \brief Info displaying (cover and metadata) window class
 */
class coverInfoWnd : public QGridLayout
{
    Q_OBJECT
public:
    //! Constructor
    explicit coverInfoWnd(QObject *parent = 0);
public slots:
    /*! \fn void newFileInfo(trackMetaData_t trackMetaData)
     *  \brief Recieve new information on track.
     *  \details Information is parsed and didplaied. Cover is included here.
     *  \param trackMetaData Structure containing meta data.
     */
    void newFileInfo(trackMetaData_t trackMetaData);
private:
    static const quint16 cover_size = 200; //!< Maximum cover size
    trackMetaData_t savedMetaData; //!< Buffer for meta data
    bool isMetaDataCopied; //!< Is meta data buffer full

    QLabel *coverLabel; //!< Label, containing cover picture
    QPixmap *actualCover; //!< Picture with actual cover
    QLineEdit *artistLabel; //!< Label with artist name
    QLineEdit *titleLabel; //!< Label with title name
    QLineEdit *albumLabel; //!< Label with album name
    QLineEdit *yearLabel; //!< Label with year name
    QLineEdit *genreLabel; //!< Label with genre name

    QPushButton *editButton; //!< Meta data edit turn on/off button
    QPushButton *copyButton; //!< Meta data copy to buffer button
    QPushButton *pasteButton; //!< Meta data paste from buffer button
    QPushButton *saveButton; //!< Meta data save button

    QCheckBox *artistCheckBox; //!< Artist should be copied and pasted
    QCheckBox *titleCheckBox; //!< Title should be copied and pasted
    QCheckBox *albumCheckBox; //!< Album should be copied and pasted
    QCheckBox *yearCheckBox; //!< Year should be copied and pasted
    QCheckBox *genreCheckBox; //!< Genre should be copied and pasted
signals:
    /*! \fn void saveEditedMetaData(trackMetaData_t data)
     *  \brief New matadata to save using id3 library.
     *  \param data Structure containing meta data to save.
     */
    void saveEditedMetaData(trackMetaData_t data);
private slots:
    /*! \fn void setLabelsReadOnly()
     *  \brief Turns meta data edit mode on and off.
     */
    void setLabelsReadOnly();
    /*! \fn void copyMetaData()
     *  \brief Meta data copy to buffer.
     */
    void copyMetaData();
    /*! \fn void pasteMetaData()
     *  \brief Meta data paste from buffer.
     */
    void pasteMetaData();
    /*! \fn void saveMetaData()
     *  \brief Meta data save.
     */
    void saveMetaData();
};

#endif // COVERINFOWND_H
